package com.example.springconfigdemo.config;

import com.example.springconfigdemo.dao.User;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@ConfigurationProperties(prefix = "users")
@RestController
public class UserConfig {
    private User user1;
    private User user2;
    @Bean
    public User user1(){
        return user1;
    }

    @Bean
    public User user2(){
        return user2;
    }

    @RequestMapping("/t")
    public String test(){
        System.out.println(user1);
        System.out.println(user2);
        return "okok";
    }

}
